package com.hj.file.controller;

import com.hj.file.service.LuceneFileService;
import com.hj.system.base.utils.ResponseUtil;
import com.hj.system.common.controller.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import java.util.Map;


/**
 * 文件处理
 *
 * @author wxf
 */

@Controller
@RequestMapping("/luence/file")
public class FileLuceneController extends BaseController {
    @Autowired
    private LuceneFileService luenceFileService;

    @RequestMapping("/list")
    public String luenceFile() {
        System.out.println("============================================");
        return "/luence/file";
    }

    @RequestMapping(value = "/upload")
    @ResponseBody
    public Map<String,Object> uploadFiles(@RequestParam("filename") MultipartFile[] files,String fileDir) {
        luenceFileService.uploadFiles(files,fileDir);
        return ResponseUtil.okContent("hello");
    }
}
